package com.cadre.web.controller.officer;

import com.cadre.common.utils.R;
import com.cadre.common.utils.common.GenerateUUID;
import com.cadre.system.domain.officer.A37;
import com.cadre.system.service.A01Service;
import com.cadre.system.service.A37Service;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

@RequestMapping({"/profess/a37"})
@RestController
/* loaded from: A37Controller.class */
public class A37Controller {
    @Resource
    private A37Service a37Service;
    @Resource
    private A01Service a01Service;

    @GetMapping({"/info/{flowId}"})
    public R info(@PathVariable("flowId") String flowId) {
        return R.ok().put("a37", (Object) ((A37) this.a37Service.getById(flowId)));
    }

    @GetMapping({"/list"})
    public R list(String personid) {
        Map<String, Object> map = new HashMap<>();
        map.put("personid", personid);
        return R.ok().put("data", (Object) this.a37Service.selectByList(map));
    }

    @PostMapping({"/save"})
    public R save(@RequestBody A37 a37) {
        GenerateUUID.getUUID();
        a37.setFlowid(GenerateUUID.getUUID());
        this.a37Service.insertSelective(a37);
        return R.ok();
    }

    @PostMapping({"/update"})
    public R update(@RequestBody A37 a37) {
        this.a37Service.updateByPrimaryKeySelective(a37);
        return R.ok();
    }

    @PostMapping({"/delete"})
    public R delete(@RequestBody String[] flowids) {
        this.a37Service.getBaseMapper().deleteBatchIds(Arrays.asList(flowids));
        return R.ok();
    }
}
